<?php


function Json($code,$msg,$data=[]){
    return response()->json(['code' => $code, 'msg' => $msg, 'data' => $data]);
}


function getRootUrl(){
    $urlInfo=parse_url(request()->url());
    return $urlInfo['scheme'].'://'.$urlInfo['host'];
}


function createFullUrl($url){
    if(empty($url)){
        return '';
    }
    if(strpos($url,'cloud://')>-1){
        return $url;
    }else{
        return env('COSV5_CDN').'/'.$url;
    }
}
function clearFullUrl($url){
   return str_replace(env('COSV5_CDN').'/','',$url);
}
